{extend name="layout:base" /}{block name="content"}
<?php
$global=isSupperManagerForSession();
?>
<style>
.table th{text-align:center;}
.tip{position:absolute;background:#9FC;border-color:#F60;z-index:9999;filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity: 0.8;opacity: 0.8;}
.hidden-detail{display:none;}
.mypointer{width:95%;overflow:hidden;height:25px;line-height:25px;cursor: pointer;}
</style>

<link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
<script src="/static/mimi/js/confirm/js/jquery-1.9.1.js"></script>

<link rel="stylesheet" href="/static/mimi/css/animate.min.css" type="text/css" />
<link rel="stylesheet" href="/static/mimi/css/font-awesome.min.css" type="text/css" />
   
<section class="topBanners">
   <div class="icon"></div>
   <div class="topBannersNav">
   		<span data-url="/admin/pushmsg/lists" onclick="ContentLoadGo('/admin/pushmsg/lists')">推送管理</span>
   </div>
</section>
   
<section id="serach_section" style="margin-top:10px;margin-left:auto;margin-right:auto;">
      <select name="ser_key" id="ser_key" class="select" >
       <option value="title" <?php if($request['ser_key']=="title"){echo 'selected';} ?>>标题</option>
       <option value="cont" <?php if($request['ser_key']=="cont"){echo 'selected';} ?>>内容</option>
      </select>
      <input type="text" class="textbox" name="ser_val" id="ser_val" value="<?php echo $request['ser_val']; ?>" placeholder=""/>

      <select id="ser_stats" class="ser_stats select" name="ser_stats">
          <option value="">--状态--</option>
          <option value="0" <?php if($request['ser_stats']=='0'){echo 'selected';} ?> >待推送</option>
          <option value="1" <?php if($request['ser_stats']=='1'){echo 'selected';} ?> >已推送</option>
      </select>

    <select name="ser_fun" id="ser_fun" class="select">
        <option value="" <?php if($request['ser_fun']==""){echo 'selected';} ?>>--功能类型--</option>
        <?php
            foreach($funLists as $key =>$val){
        ?>
        <option value="<?php echo $key; ?>" <?php if($key == $request['ser_fun'] &&  $request['ser_fun']!=""){echo 'selected';} ?>><?php  echo $val?></option>
        <?php
             }
        ?>
    </select>

    <select name="ser_push_time_type" id="ser_push_time_type" class="select">
        <option value="" <?php if($request['ser_push_time_type']==""){echo 'selected';} ?>>--推送类型--</option>

        <option value="0" <?php if('0' == $request['ser_push_time_type']){echo 'selected';} ?>>立即推送</option>
        <option value="1" <?php if('1' == $request['ser_push_time_type']){echo 'selected';} ?>>定时推送</option>
        <option value="2" <?php if('2' == $request['ser_push_time_type']){echo 'selected';} ?>>每日循环推送</option>

    </select>
      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />
      	<?php
	    if( ( in_array(-2201,$ruleLists) || $global==1) )
		{
    	?>
      <input power="-2201" type="button" value="添加" class="group_btn add fr" />
      	<?php
      	}
      	?>
      <br style="clear:both;width:0px;height:0px;">
</section>
 
<table class="table" style="margin-top:10px;">
<tr>
<th style="width:100px;">创建时间</th>
<th style="width:80px;">接收者</th>
<th style="width:100px;">标题</th>
<th style="width:100px;">内容</th>
<th style="width:50px;">功能类型</th>
<th style="width:50px;">功能编号</th>
<th style="width:50px;">值</th>
<th style="width:50px;">状态</th>
<th style="width:100px;">推送类型</th>
<th style="width:50px;">操作</th>
</tr>
<?php 
foreach($lists['data'] as $key=>$val)
{
?>
<tr data-id="<?php echo $val['id']; ?>">
<td style="text-align:left;"><?php echo $val['ctime']; ?></td>
<td><?php
$string="";
if($val['ty']==0)
{
    $string= $val['UserInfo']['nickname'];
}else
{
    $string= '群['.$val['push_num'].']条,['.$val['push_page'].']页';
}
?>

    <div class="mypointer" data-toggle="tooltip"
         data-placement="bottom" title="<?php echo $string; ?>" style="text-align: left;"><?php echo $string; ?></div>
</td>
<td style="text-align:left;">
<div class="mypointer" data-toggle="tooltip"
data-placement="bottom" title="<?php echo $val['title']; ?>" style="text-align: left;"><?php echo $val['title']; ?></div>
</td>
<td style="text-align:left;">
<div class="mypointer" data-toggle="tooltip"
data-placement="bottom" title="<?php echo $val['cont']; ?>" style="text-align: left;"><?php echo $val['cont']; ?></div>
</td>
<td><?php echo $val['funMapper'];?></td>
<td><?php echo $val['fun'];?></td>
<td><?php echo $val['val'];?></td>

<td><?php echo $val['statsMapper'];?></td>
    <td>
        <?php echo $val['pushTimeTypeMapper'];?>
        <?php
            if($val['push_time_type']>0)
            {
                echo "<br>[".$val['push_time_val']."]";
            }
        ?>
    </td>
<td style="text-align:right;">



<?php
if( ( in_array(-2202,$ruleLists) || $global==1) )
{
?>
<input type="button" power="-2202" value="删除" class="link_btn del"/>
<?php
}
?>
</td>
</tr>

<?php
}
?>
</table>
{include file="../application/admin/view/layout/page_tpl_new.html" /}
<script type="text/javascript">
function myResearch(){
    var url="/admin/pushmsg/lists";
    var generaData=$("#serach_section [name^='ser_']");
    var page=$("#cpage").val();
    var param={
        page:page
    };
    getSearchFormData(generaData,param);
    ContentLoadGo(url,param);
}

$(function(){
 //设置搜索栏
 $(".research").unbind().bind("click",function(){
    var page =$(this).attr("page");
    $("#cpage").val(page);
    myResearch();
 });

//删除
$(".del").unbind().bind("click",function(){
   var that =this;
   var url="/admin/pushmsg/delData";
   var id=$(that).parent().parent().attr('data-id');
   var param={
           id:id
   };
   cofirmsss_tishi(1,'您确定要删除吗?',function(id){

       AjaxRequest(url,param,function(data){
           if(data.err==0)
           {
               SuccessTiShi("操作成功");

               $(that).parent().parent().remove();
               myResearch();
           }
           else
           {
               ErrTiShi("操作失败");
           }
       });

   });
});

        	   
//导航
$(".topBannerItem").unbind().bind("click",function(){
   var attArr = $(this).attr();
   goToSelfLink(attArr);

});
//添加
$(".add").unbind().bind("click",function(){
   var that =this;
   var url="/admin/pushmsg/addData";
   var param={};
   ContentLoadGo(url,param);
     //弹出：确认按钮
});

    $(".setAvail").unbind().bind("click",function(){
        var that =this;
        var url="/admin/pushmsg/setAvail";
        var id=$(that).parent().parent().attr('data-id');
        var param={
            id:id
        };
        cofirmsss_tishi(1,'您确定放入推送队列吗?',function(id){
            AjaxRequest(url,param,function(data){
                if(data.err==0)
                {
                    myResearch();
                }
                else
                {
                    ErrTiShi("操作失败");
                }
            });

        });

    });

        	   
//全选
$("#all").unbind().bind("click",function(){
    if(this.checked){
        $(".checkBoxInput").attr("checked", true);
        $(".checkBoxInput").prop("checked", true);
    }else{
        $(".checkBoxInput").attr("checked", false);
        $(".checkBoxInput").prop("checked", false);
    }
    var se=getAllSelectItem();
});

});
</script>
<script>
$(function (){
    $("[data-toggle='tooltip']").tooltip();
});
</script>
{/block}
   